﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace Pg.BioMedics.SDR.Services
{
    /// <summary>
    /// Provides utility methods supporting some text based routines
    /// </summary>
    internal static class TextHelper
    {
        #region Constants

        private const string NonAlphaNumericPattern = @"[^0-9|A-Z|a-z| ]";

        #endregion

        #region Static methods

        /// <summary>
        /// Removes all not alpha numeric caharcters from the input string.
        /// </summary>
        /// <param name="input">Input string</param>
        /// <returns>Output string</returns>
        internal static string RemoveNonAlphaNumeric(string input)
        {
            if (String.IsNullOrEmpty(input))
                return input;

            return Regex.Replace(input, NonAlphaNumericPattern, String.Empty);
        }

        #endregion
    }
}
